#pragma once

#include<iostream>
#include<functional>
#include<vector>

typedef void(*fun_t)();


void PrintfLog()
{
    std::cout<<"打印日志，正在执行..."<<std::endl;
}
void InsertMySQL()
{
    std::cout<<"数据库任务，正在执行..."<<std::endl;

}
void NetRequest()
{
    std::cout<<"网络请求，正在执行..."<<std::endl;

}

#define COMMAND_LOG 0
#define COMMAND_MYSQL 1
#define COMMAND_REQUEST 2

class Task
{
    public:
    Task()
    {
        funcs.push_back(PrintfLog);
        funcs.push_back(InsertMySQL);
        funcs.push_back(NetRequest);

    }
    void Execute(int command)
    {
        if(command>=0&&command<funcs.size())
        {
            funcs[command]();
        }
    }
    ~Task()
    {}
std::vector<fun_t> funcs;

};

